package com.cbgolf.oa.activity.bill;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import com.cbgolf.oa.base.BaseActivity;
import com.cbgolf.oa.model.AccountDetailsModel;
import com.cbgolf.oa.presenter.IPresenterImp;
import com.cbgolf.oa.views.AccountDetailsView;
import com.cbgolf.oa.R;

/**
 * @author Created by lq on 2017/11/5.
 */

public class AccountDetails extends BaseActivity implements
    IPresenterImp {

  private AccountDetailsView view;
  private AccountDetailsModel model;
  private String customerId;
  private String recordDate;
  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.a_account_details);
  }

  @Override
  protected void findViews() {
    Intent intent = context.getIntent();
    customerId = com.cbgolf.oa.util.DataUtil.getStringExtra(intent, "id");
    recordDate = com.cbgolf.oa.util.DataUtil.getStringExtra(intent, "recordDate");
    view = new com.cbgolf.oa.views.AccountDetailsView(this, this);
    model = new com.cbgolf.oa.model.AccountDetailsModel(this, this);
  }

  @Override
  protected void loadData() {
    super.loadData();
    model.getData(customerId,recordDate);
  }

  @Override
  public String getActivityTitle() {
    return "消费明细";
  }

  @Override
  public void back() {
    finish();
  }

  @Override
  public void showProgress() {
    com.cbgolf.oa.util.AnimaUtil.showLoading(context);
  }

  @Override
  public void stopProgress() {
    com.cbgolf.oa.util.AnimaUtil.stopLoading();
  }

  @Override
  public void getDataFail(String msg) {
    com.cbgolf.oa.util.Util.show(msg);
  }

  @Override
  public void getDataSuccess(Object obj) {
    view.getDataSuccess(obj);
  }

  @Override
  public void getDataFail(String msg, int code) {
    com.cbgolf.oa.util.Util.show(msg);
  }
}
